package com.gw.jpa.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

@Table(name = "emp")
@Entity
@Setter
@Getter
//员工类
public class Emp {
    @Id
    private Integer empno; //员工编号
    private String ename; //员工姓名
    private String job; //员工工作
    private Integer mgr; //员工领导编号
    @Column(name = "hiredate")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date hiredate; //员工出生日期
    private Double sal; //员工薪水
    private Double comm; //员工奖金
    private Integer deptno; //员工部门编号
    @ManyToOne(targetEntity = Dept.class)
    @JoinColumn(name = "e_deptno",referencedColumnName = "deptno")
    @JsonIgnoreProperties(value = "empSet")
    private Dept dept;

    public Emp() {
    }

    public Emp(Integer empno, String ename, String job, Integer mgr, Date hiredate, Double sal, Double comm, Integer deptno) {
        this.empno = empno;
        this.ename = ename;
        this.job = job;
        this.mgr = mgr;
        this.hiredate = hiredate;
        this.sal = sal;
        this.comm = comm;
        this.deptno = deptno;
    }
}
